package com.myCommunity.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.myCommunity.dao.UserDao;
import com.myCommunity.entity.User;
@Repository("userDao")
public class UserDaoImpl extends BeseDao implements UserDao {

	public User login(String userName, String password) {
		String hql="from User u where u.userName=? and u.password=?";
		List<User> list = (List<User>) getHibernateTemplate().find(hql,userName,password);
		return list.size()>0?list.get(0):null;
	}

	public void register(User user) {
		getHibernateTemplate().save(user);
	}

}
